home *** CD-ROM | disk | FTP | other *** search
- { XtaC }
- unit OBJPCX;
- interface
- Uses Crt;
- {This links the PCX object file to the executable code}
- Type Virtual = Array[0..64000] Of Byte;
- VirtPtr = ^Virtual;
- {Same here}
- Const Vga = $A000;
-
- {Now... This is a direct pointer to the picture's array [320x200]=64000}
- {So it stores the info in the PicPtr Array}
-
- Var VirtScr: VirtPtr;{Get a life}
- VAddr: Word;
- PalOffset: LongInt;
-
- Procedure SetPCXPal(PCX: VirtPtr;PicSize: LongInt);
- procedure pic;
- procedure ReadObjPcx(gseg: word;PCX: VirtPtr);
-
- implementation
- {$L Pic.OBJ}
- procedure pic; external;
-
- Procedure SetPCXPal(PCX: VirtPtr;PicSize: LongInt);
- var pal : array[0..767] of byte; I: Word;
- begin
- PalOffset:=PicSize-768;
- for i:=0 to 767 do pal[i]:=PCX^[PalOffset+i];
- asm cld; xor di,di; xor bx,bx;
- @L1: mov dx,03c8h; mov ax,bx; out dx,al; inc dx; mov cx,3;
- @L2: mov al,byte ptr pal[di]; shr al,1; shr al,1; out dx,al;
- inc di; loop @L2; inc bx; cmp bx,256; jne @L1; end;
- end;
-
- procedure ReadObjPcx(gseg: word;PCX: VirtPtr);
- var offset,i,j,v,k,count,loop:integer;
- gofs:word;
- begin
- offset:=128; gofs:=0; count:=0; j:=200;
- for i := 0 to 351 do begin
- j:=0;
- while j < 310 do begin
- v:=PCX^[offset+count]; inc(count);
- if (v and 192) = 192 then begin
- loop := v and 63;
- inc(j,loop);
- v:=PCX^[offset+count]; inc(count);
- for k := 1 to loop do begin
- mem[gseg:gofs] := v;
- inc(gofs); inc(j);
- end;
- end
- else begin
- mem[gseg:gofs] := v;
- inc(gofs);
- end;
- end;
- end;
- end;
- end.